package es.us.idinfor.test;

import java.util.Calendar;
import java.util.Date;

import es.us.idinfor.Event;
import es.us.idinfor.Sequence;
import es.us.idinfor.Sequences;

public class ImplicitMain {
	public static void main(String[] args) throws Exception {
		Calendar c = null;
		Date start = null;
		Date end = null;
		
		// Secuencia 1
		c = Calendar.getInstance();
		start = c.getTime();
		c.add(Calendar.SECOND, 7);
		end = c.getTime();
		
		Sequence s1 = new Sequence("s1", start.getTime(), end.getTime());
		
		Event a1 = new Event("A");
		Thread.sleep(1000);
		Event b1 = new Event("B");
		Thread.sleep(1000);
		Event b2 = new Event("B");
		Thread.sleep(1000);
		Event c1 = new Event("C");
		Thread.sleep(1000);
		Event c2 = new Event("C");
		Thread.sleep(1000);
		Event b3 = new Event("B");
		Thread.sleep(1000);
		Event d1 = new Event("D");
		Thread.sleep(1000);
		
		s1.add(a1);
		s1.add(d1);
		s1.add(c2);
		s1.add(b1);
		s1.add(c1);
		s1.add(b3);
		s1.add(b2);
		
		// Secuencia 2
		c = Calendar.getInstance();
		start = c.getTime();
		c.add(Calendar.SECOND, 8);
		end = c.getTime();
		
		Sequence s2 = new Sequence("s2", start.getTime(), end.getTime());
		
		a1 = new Event("A");
		Thread.sleep(1000);
		c1 = new Event("C");
		Thread.sleep(1000);
		b1 = new Event("B");
		Thread.sleep(1000);
		c2 = new Event("C");
		Thread.sleep(1000);
		b2 = new Event("B");
		Thread.sleep(1000);
		b3 = new Event("B");
		Thread.sleep(2000);
		d1 = new Event("D");
		Thread.sleep(1000);
		
		s2.add(a1);
		s2.add(c1);
		s2.add(b1);
		s2.add(c2);
		s2.add(b2);
		s2.add(b3);
		s2.add(d1);
		
		// Secuencia 3
		c = Calendar.getInstance();
		start = c.getTime();
		c.add(Calendar.SECOND, 8);
		end = c.getTime();
		
		Sequence s3 = new Sequence("s3", start.getTime(), end.getTime());
		
		a1 = new Event("A");
		Thread.sleep(1000);
		b1 = new Event("B");
		Thread.sleep(1000);
		b2 = new Event("B");
		Thread.sleep(1000);
		c1 = new Event("C");
		Thread.sleep(2000);
		c2 = new Event("C");
		Thread.sleep(2000);
		d1 = new Event("D");
		Thread.sleep(1000);
		
		s3.add(a1);
		s3.add(b1);
		s3.add(b2);
		s3.add(c1);
		s3.add(c2);
		s3.add(d1);
		
		System.out.println(s1);
		System.out.println(s2);
		System.out.println(s3);
		
		Sequences ss = new Sequences();
		ss.add(s1);
		ss.add(s2);
		ss.add(s3);
		
		System.out.println(ss.getMaximumSimilarWindow());
	}
}
